package Thread;

import java.util.concurrent.locks.ReentrantLock;

public class ThreadDemo23 {

    public static void main(String[] args) {
        ReentrantLock reentrantLock = new ReentrantLock(true);
        boolean res = reentrantLock.tryLock();
        try {
            reentrantLock.lock();
        }finally {
            if (res) {
                reentrantLock.unlock();
            }
        }
    }

}
